<?php 
class Admin_contact extends Controller
{
	function __construct()
	{
		parent::__construct();	
		
        $this->load->library('session');
	    if($this->session->userdata('admin') == '')
    	{
    		 redirect('admin');
    	}
        
		$this->load->helper(array('form','url'));
		
	}
	
	function index()
	{
		$this->load->model('admin_contact_model');
        
        $this->load->library(array('form_validation'));
		
		if($_POST['submit'] == 'Submit')
		{
				$this->form_validation->set_error_delimiters('<div class="error">','</div>');
			
            $this->form_validation->set_rules('email1','email','valid_email|trim|xss_clean');			
			$this->form_validation->set_rules('email2','email','valid_email|trim|xss_clean');			
			$this->form_validation->set_rules('email3','email','valid_email|trim|xss_clean');			
			$this->form_validation->set_rules('email4','email','valid_email|trim|xss_clean');			
			$this->form_validation->set_rules('email5','email','valid_email|trim|xss_clean');
			
			//$this->validation->set_fields($fields);
			
			$this->form_validation->set_message('valid_email', 'Please enter the valid %s address');
			
			
			if ($this->form_validation->run() == TRUE)
			{
                $this->admin_contact_model->updateContact();            
			}
            
            
            	
		}
		
		$data['query'] = $this->admin_contact_model->getAllResult();
		$this->load->view(TEMPLATE_NAME.'/admin/admin_contact_view', $data);	
	}
}
?>